#define EXT_FUNC 

typedef struct tagPublicKey
{
	int size;
	long keySerial;
	word32 timestamp;
	char userid[256];
	unit n[MAX_UNIT_PRECISION], e[MAX_UNIT_PRECISION];
	word32 crc;
} PublicKey, *pPublicKey;

typedef struct tagSecretKey
{
	int size;
	long keySerial;
	word32 timestamp;
	char userid[256];
	unit n[MAX_UNIT_PRECISION], e[MAX_UNIT_PRECISION];
	unit d[MAX_UNIT_PRECISION];
	unit p[MAX_UNIT_PRECISION], q[MAX_UNIT_PRECISION];
	unit u[MAX_UNIT_PRECISION];
	word32 crc;
} SecretKey, *pSecretKey;

int EXT_FUNC InitIPriv();
void EXT_FUNC TermIPriv();
int EXT_FUNC GetIPrivLastError(char *sBuffer, int nLength);

boolean checkPublicKey(pPublicKey pKey);
boolean checkSecretKey(pSecretKey pKey);
int CheckMFileSign(MemFile *infile, MemFile *sigfile, pPublicKey pKey);
int SignMFile(MemFile *f, MemFile *g, pSecretKey pKey);
int EncryptMFile(MemFile *f, MemFile *g, pPublicKey pKey);
int DecryptMFile(MemFile *infile, MemFile *outputfile, pSecretKey pKey);

void IPrivClearResources();
